package com.wwl.cms.utils.designModeTest.flyweight;

/**
 * @author wwl
 * @version 1.0
 * @date 2021/9/8 18:09
 * @description:
 */
public class Client {
    public static void main(String[] args) {
        //创建一个工厂类
        WebSiteFactory factory = new WebSiteFactory();

        //客户要一个一新闻形式发布的网站
         WebSite webSite1 = factory.getWebSiteCategory("新闻");

         webSite1.use(new User("tom"));

         //客户发布一个以博客形式发布的网站
        WebSite webSite2 = factory.getWebSiteCategory("博客");
        webSite2.use(new User("jack"));
        WebSite webSite3 = factory.getWebSiteCategory("博客");
        webSite3.use(new User("smith"));
        WebSite webSite4 = factory.getWebSiteCategory("博客");
        webSite4.use(new User("king"));
        System.out.println("网站的分类共="+factory.getWebSiteCount());


    }
}
